﻿<?php
/*
 cookie对回话的影响 未测试
 
*/
 //整形字段插入空值 $id='NULL',再插入$id
 
  session_start(); 
  require_once("../include/db_mysql.php");
  require_once("../include/updateLogoFile.php");
  $partyTypeId='NULL';
  $partyName=$_POST['partyName'];  
  $_SESSION['partyName'] = $partyName;
  $partyLogo =updateLogoFile($_FILES,$partyName);
  $registerId= 'NULL';
  $description=$_POST['description'];
  $homePageId= 'NULL';
  $industryName = $_POST['industryName'];
  $industryId = 'NULL' ;
  $link = new SqlClass();
  $link->connect();
  $sqlCommand = "select industryId from industry where industryName='$industryName'";
  $result = $link->exec_sql($sqlCommand);
  while($row=mysql_fetch_array($result))
  {
    $industryId = $row['industryId'];
	break;
  }
  $industryId = intval($industryId);
  $fixedPhone = $_POST['fixedPhone'];
  $mobilePhone= $_POST['mobilePhone'];
  $fax=$_POST['fax'];
  $email=$_POST['email'];
  $recordDateTime= date("Y-m-d H:i:s");
  //主键值未插入，数据库自动增长
  $sqlCommand="insert into party(partyTypeId,partyName,partyLogo,registerId,description,homePageId,industryId,fixedPhone,mobilePhone,fax,email,recordDateTime) values($partyTypeId,'$partyName','$partyLogo',$registerId,'$description',$homePageId,$industryId,'$fixedPhone','$mobilePhone','$fax','$email','$recordDateTime')";
  $link->exec_sql($sqlCommand);
   //并发时 返回的 是别人新插入的值？ 
  $insertId=mysql_insert_id(); 
  //$sqlCommand ="insert into partyPageInfo(partyAlbumId) values ($insertId)";
  //$link->exec_sql($sqlCommand);
  //partyPageRegister 使用
  $_SESSION['partyId'] = $insertId; 
  
  $link->close();
     
  //转入下一页面
  header("Location: partyPageRegister.html");
?>